use winit::event_loop::EventLoop;

use super::{WindowSystem, WindowSystemCreateInfo};

impl WindowSystemCreateInfo {
    pub fn new() -> Self {
        Self {
            title       : String::from("TestWindow"),
            width       : 1024,
            height      : 768
        }
    }
}

impl WindowSystem {
    pub fn new(window_ci: &WindowSystemCreateInfo) -> Self {
        let event_loop = EventLoop::new();

        let window = std::rc::Rc::new(
            winit::window::WindowBuilder::new()
                .with_title(&window_ci.title)
                .with_inner_size(winit::dpi::LogicalSize::new(window_ci.width, window_ci.height))
                .build(&event_loop)
                .expect("Failed to create window.")
        );

        Self {
            w_event_loop    : Some(event_loop),
            w_window        : window
        }
    }
}